<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<script type="text/javascript">
	$(document).ready(
			function() {
				$('.edit-cipeproject-link').click(
						function() {
							loadDiv('content',
									'showEditKnowledgeManagement.do?id='
											+ $(this).attr('cipeprojectId'));

						});

			$(".tablesorter").tablesorter() .tablesorterPager({
			        container: $("#pager"),			       
			        size:10 
			});
			});
</script>
<%@ include file="/common/pager.jsp"%>
<table class="tablesorter">
	<c:choose>
		<c:when test="${!empty cipeprojectList}">
			<thead>
				<tr>
					<th><spring:message code="knowledgeManagementlist.table.heading.projectID" /></th>					
					<th><spring:message code="cipeprojectlist.table.heading.projectTitle" /></th>
					<th><spring:message code="knowledgeManagementlist.table.heading.startDate" /></th>
					<th><spring:message code="knowledgeManagementlist.table.heading.endDate" /></th>
					<th><spring:message code="knowledgeManagementlist.table.heading.acronym" /></th>
					<th><spring:message code="knowledgeManagementlist.table.heading.partner" /></th>
					<th><spring:message code="knowledgeManagementlist.table.heading.region" /></th>
					<th><spring:message code="knowledgeManagementlist.table.heading.country" /></th>
					<th><spring:message code="knowledgeManagementlist.table.heading.status" /></th>
					<th><spring:message code="knowledgeManagementlist.table.heading.organizationtype" /></th>
					<th><spring:message code="knowledgeManagementlist.table.heading.managementFunds" /></th>
				</tr>
			</thead>
			<tbody id="paymentRqst">
				<c:forEach items="${cipeprojectList}" var="cipeproject">
					<tr>
						<td>
                          <c:choose>
                            <c:when test="${not empty allowedUiElements['Project Catalogue (View)']['View link']}">                              
                              <a href="javascript://" class="edit-cipeproject-link" cipeprojectId="${cipeproject.id}">${cipeproject.projectID}</a>
                            </c:when>
                            <c:otherwise>                                
                              ${cipeproject.projectID}
                            </c:otherwise>
                          </c:choose>                    
                        </td>
						<td>${cipeproject.projectTitle}</td>
						<td><fmt:formatDate pattern="MM-dd-yyyy" value="${cipeproject.projectStartDate}" /></td>
						<td><fmt:formatDate pattern="MM-dd-yyyy" value="${cipeproject.projectEndDate}" /></td>
						<td>${cipeproject.acronym}</td>
						<td>${cipeproject.partner.partnerName}</td>
						<td>${cipeproject.region.displayName}</td>
						<td>${cipeproject.country.displayName}</td>
						<td>${cipeproject.cipeprojectstatus.displayName}</td>
						<td>${cipeproject.organizationtype.displayName}</td>
						<td><fmt:formatNumber type="currency" value="${cipeproject.cipeFunds}" pattern="$#,##0;"/></td>
					</tr>
				</c:forEach>
		</c:when>
		<c:otherwise>
			<c:if test="${ !empty param.action}">
				<tr>
					<td colspan="12">Your query has returned 0 records</td>
				</tr>
			</c:if>
		</c:otherwise>
	</c:choose>
	</tbody>
</table>